<template>
  <div class="tab">
    <div class="tab-list">
      <div
        v-for="(item, index) in tabCfg"
        :key="index"
        class="tab-list__item"
        :class="{
          active: value === item.value
        }"
        @click="tabChange(item.value)"
      >
        {{ item.label }}
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: '',
  props: {
    value: {
      type: [String, Number],
      default: ''
    },
    tabCfg: {
      type: Array,
      default: () => ([])
    }
  },

  data() {
    return {

    }
  },
  methods: {
    tabChange(value) {
      this.$emit('input', value)
    }
  }
}
</script>
<style lang="scss" scoped>
.tab {
  background-color: #fff;
  width: 230px;
  height: 60vh;
  border-radius: 4px;
  &-list {
    padding: 20px 20px;
    width: 100%;
    &__item {
      padding: 13px;
      margin-bottom: 10px;
      text-align: center;
      cursor: pointer;
      &:last-child {
        margin: 0;
      }
    }
  }
  .active {
    background-color: #409EFF;
    border-radius: 5px;
    color: #fff;
  }

}

</style>
